package com.victor.service.impl;

import java.util.List;

import javax.print.attribute.standard.MediaSize.NA;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.CityDao;
import com.victor.entity.city.CityIntroduce;
import com.victor.entity.city.CityIntroducePhoto;
import com.victor.entity.collection.Collections;
import com.victor.entity.comments.CommentPhoto;
import com.victor.entity.comments.Comments;
import com.victor.entity.praise.CityPraise;
import com.victor.entity.praise.CommentsPraise;
import com.victor.service.CityService;

@Service
public class CityServiceImpl implements CityService {
	@Autowired
	private CityDao dao;

	@Override
	public PageInfo<CityIntroduce> selAll(String search, int page, int row, String province) {
		PageHelper.startPage(page, row);
		List<CityIntroduce> list = dao.selAll(search,province);
		return new PageInfo<>(list, 5);
	}

	@Override
	public boolean insertCity(CityIntroduce cityIntroduce) {
		return dao.insertCity(cityIntroduce);
	}

	@Override
	public CityIntroduce selCityById(String id,String uid) {
		return dao.selCityById(id,uid);
	}

	@Override
	public boolean updateCity(CityIntroduce city) {
		return dao.updateCity(city);
	}

	@Override
	public boolean delCity(int[] ids) {
		return dao.deleteCity(ids);
	}

	@Override
	public boolean delComments(String id) {
		return dao.deleteComments(id);
	}


	@Override
	public boolean delPhoto(Integer cid) {
		return dao.delPhoto(cid);
	}

	@Override
	public boolean insertPhoto(CityIntroducePhoto cityIntroducePhoto) {
		return dao.insertPhoto(cityIntroducePhoto);
	}

	@Override
	public Collections selCollectionsByPidAndType(String pid,String uid) {
		return dao.selCollectionByTypeAndPid(pid,uid);
	}

	@Override
	public boolean insertCollection(Collections collections) {
		return dao.insertCollections(collections);
	}

	@Override
	public boolean delCollectios(Integer id) {
		return dao.deleteCollection(id);
	}

	@Override
	public CityPraise selCityPraiseByCityID(String cityid,String uid) {
		return dao.selCityPraiseByCityId(cityid,uid);
	}

	@Override
	public boolean insertCityPraise(CityPraise cityPraise) {
		return dao.insertCityPraise(cityPraise);
	}

	@Override
	public boolean delCityPraise(Integer id) {
		return dao.deleteCityPraise(id);
	}

	@Override
	public String selCityPraiseCount(String cityid) {
		return dao.selCitypraiseCount(cityid);
	}

	@Override
	public boolean updateForwardCount(String cityid) {
		return dao.updateForwardCount(cityid);
	}

	@Override
	public List<Collections> selIfCollections(Collections collections) {
		return dao.selIfCollections(collections);
	}

	@Override
	public CityIntroduce selCityByName(String city) {
		return dao.selCityByName(city);
	}


}
